﻿namespace Middleware.ApiTest.Attributes
{
    // 数值脱敏特性
    [AttributeUsage(AttributeTargets.Property)]
    public class NumericMaskAttribute : Attribute
    {
        public object MaskValue(object original)
        {
            if (original == null) return null;

            if (original is decimal || original is decimal?) return 0.00m;
            if (original is int || original is int?) return 0;
            if (original is double || original is double?) return 0.0;

            return original; // 其他类型不处理
        }
    }
}
